"""
This script handles the heads up display.
"""

def main(cont):
	import GameLogic as gl
	obs = gl.getCurrentScene().objects
	
	# The list of objects to update
	laps = obs['OBLaps']
	timer = obs['OBTimer']

	#
	# The lap counter
	#
	
	# We need to display lap information, but can only get it if it's setup.
	if not hasattr(gl, 'laps') or not hasattr(gl, 'maxlaps'):
		#Skip if we don't have info
		laps['Text'] = "Laps: 0/0"
	else:
		laps['Text'] = "Laps: %i/%i" % (gl.laps, gl.maxlaps)
		
	#	
	# The timer
	#
	
	# Stop updating the timer if a victory message is received
	if not cont.owner['End']:
		timer['Text'] = "Time: %.01f" % timer['Time']